﻿using System;
using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json;

namespace T.FAS.Runtime.Metadata.Entity.DataModel
{
    /// <summary>
    /// 数据对象的列分类信息
    /// </summary>
    [Serializable]

    public class DataColumnCategoryInfo
    {
        /// <summary>
        /// ID
        /// </summary>
        public string ID { get; set; }

        /// <summary>
        /// 数据对象ID
        /// </summary>
        [JsonIgnore]
        public string DataObjectID { get; set; }

        /// <summary>
        /// 分类编号
        /// </summary>
        public string Code { get; set; }

        /// <summary>
        /// 分类名称
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// 是否默认分类
        /// </summary>
        public bool IsDefault { get; set; }

        /// <summary>
        /// 上级分类id
        /// </summary>
        public string ParentID { get; set; }

        /// <summary>
        /// 是否禁用
        /// </summary>
        public bool Disabled { get; set; }

        /// <summary>
        /// 创建人
        /// </summary>
        [JsonIgnore]
        public string Creator { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>        
        [JsonIgnore]
        public DateTime CreateTime { get; set; }

        /// <summary>
        /// 最后修改人
        /// </summary>
        [JsonIgnore]
        public string LastModifier { get; set; }

        /// <summary>
        /// 最后修改时间
        /// </summary>        
        [JsonIgnore]
        public DateTime LastModifyTime { get; set; }

        public List<DataColumnCategoryInfo> Children { get; set; }

        public object Clone()
        {
            return this.MemberwiseClone();
        }

        public static DataColumnCategoryInfo Default => new DataColumnCategoryInfo
        {
            ID = "defaultCategory",
            Code = "Basic",
            Name = "基础信息",
            IsDefault = true,
            ParentID = "0",
            DataObjectID = "defaultCategory"
        };
    }
}
